package org.kojo.tdrm.servlet.ctrl;

import java.io.IOException;
import java.util.Date;
import java.util.logging.Logger;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONObject;
import org.kojo.tdrm.entity.User;
import org.kojo.tdrm.service.UserAppService;

public class UserAppController extends BaseController {
	private static Logger log = Logger.getLogger(UserAppController.class.getName());
	private UserAppService service = null;
	/**
	 * 
	 */
	private static final long serialVersionUID = 710155712056970854L;
	public UserAppController(){
		service = new UserAppService();
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String loginName = req.getParameter("loginName");
		User user = new User(loginName,new Date());
		service.createUser(user);
		log.info("create="+user);
		JSONObject j = new JSONObject(user);
		super.setJsonResp(j.toString());
	}
	
}
